﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Interop.Security.AzRoles;
using System.Runtime.InteropServices;

namespace Authorization
{
    [Guid("63FD8F5E-D487-4445-A593-D70E2CE69F30")]
    public class CustomObjectPicker : IAzObjectPicker
    {


        //IAzObjectPicker
        AzPrincipalLocatorClass locator;
        public CustomObjectPicker()
        {
            //locator.ObjectPicker.
      
        }

        #region IAzObjectPicker Members

        public object GetPrincipals(ref _RemotableHandle hParentWnd, string bstrTitle, out object pvSidTypes, out object pvNames)
        {
            CustomObjectPickerForm form = new CustomObjectPickerForm();
           
            IntPtr  address = Marshal.AllocHGlobal(IntPtr.Size);

            //Write the IntPtr ijnto unmanaged memory
  //          Marshal.WriteIntPtr(address, hParentWnd);

            //Return the RemotableHandle by marshalling it from unmanaged memory
//            Marshal.PtrToStructure(address, GetType(WIAVIDEOLib._RemotableHandle))

            Marshal.StructureToPtr(hParentWnd.GetType(), address, true);
            form.Show(new WindowWrapper(address));
            pvSidTypes = null;
            pvNames = null;
            return null;
       }

        public string Name
        {
            get { return "Membershipt Object Picker"; }
        }

        #endregion
    }
}
